<%@ page import="com.example.Pojo.Profit" %>
<%@ page import="java.util.List" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" isELIgnored="false" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <base href="http://localhost:8080/Barbr/">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>收益情况</title>
    <link href="https://cdn.bootcdn.net/ajax/libs/twitter-bootstrap/5.0.2/css/bootstrap.css" rel="stylesheet">
    <script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.6.0/jquery.js"></script>
    <script src="https://cdn.bootcdn.net/ajax/libs/twitter-bootstrap/5.0.2/js/bootstrap.js"></script>
    <style>
        body{
            background-image: url('img/photo.jpg');
        }
    </style>
</head>

<body>
<%
    HttpSession session1 = request.getSession();
    List<Profit> profit = (List<Profit>) session1.getAttribute("profit");
    double x=0;
    for (Profit p:profit){
        x+=p.getPrice();
    }

%>
<div class="container">
    <h2 class="text-center">理发师收益情况</h2>
    <div class="table-responsive">
        <table class="table table-bordered table-hover">
            <tr>
                <th>序号</th>
                <th>理发师姓名</th>
                <th>理发师等级</th>
                <th>收益金额</th>
                <th>日期</th>
            </tr>
            <c:forEach items="${sessionScope.profit}" var="item">
                <tr>
                    <td><input type="text" value="${item.id}" disabled/></td>
                    <td><input type="text" value="${item.username}" disabled/></td>
                    <td><input type="text" value="${item.level}" disabled/></td>
                    <td><input type="text" value="${item.price}" disabled/></td>
                    <td><input type="text" value="${item.date}" disabled/></td>
                </tr>
            </c:forEach>
            <tr>
                <td colspan="3" style="color: midnightblue"><b>总收益:</b></td>
                <td style="color: midnightblue" colspan="2"><b>金额</b><span><%=x%>元</span></td>
            </tr>
        </table>
    </div>
</div>
</body>

</html>